﻿package blob.mechanisms
{
    import blob.characters.*;
    import blob.levelstates.*;
    import org.flixel.*;

    public class Door extends FlxSprite implements Mechanism
    {
        private var doorImg1:Class;
        private var doorImg2:Class;
        private var rotation:Number;
        private var afterActivateDoor:Door;
        private var thisDoor:Door;
        private var activated:Boolean;

        public function Door(param1:Number, param2:Number)
        {
            this.doorImg1 = Door_doorImg1;
            this.doorImg2 = Door_doorImg2;
            super(param1, param2);
            loadGraphic(this.doorImg1, true, true, 20, 100);
            immovable = true;
            return;
        }// end function

        public function setAfterActivateDoor(param1:Door) : void
        {
            param1.loadGraphic(this.doorImg2, true, true, 100, 20);
            this.afterActivateDoor = param1;
            var _loc_2:* = FlxG.state as PlayState;
            _loc_2.add(this.afterActivateDoor);
            _loc_2.doors.add(this.afterActivateDoor);
            this.afterActivateDoor.kill();
            return;
        }// end function

        public function activate(param1:Character) : void
        {
            if (!this.activated)
            {
                kill();
                this.afterActivateDoor.revive();
            }
            else
            {
                revive();
                this.afterActivateDoor.kill();
            }
            this.activated = !this.activated;
            return;
        }// end function

        public function toggle() : void
        {
            return;
        }// end function

    }
}
